Custom Screen Validator - Sample Code

Create a Custom Validator for screen validation

This sample plugin demonstrates screen-wide custom validation. Custom validation of screens is useful when data validity depends on a combination of values from different controls. For an example of how to validate an individual control, refer to the Create a Custom Validator for control validation example.

About the sample

In this example, we validate the country and postcode details entered by the user using the following rules:

 

The sample code demonstrates:

 

The sample code needs the following to run:

To setup this scenario

  1. Copy the rulebase .zip file (CustomValidatorExample.zip) from examples\rulebases\compiled to the rulebase folder in Web Determinations (for example, <webroot>\WEB-INF\classes\rulebases)
  2. Copy and install the CustomScreenValidator.jar file (located in examples\interview-engine\custom-screen-validator) into Web Determinations; for more information, refer to Create a Plugin. If you wish to modify the CustomScreenValidator code, do the following:
  1. Copy the code for the CustomScreenValidator plugin.
  2. Modify the validation code in the handleEvent method.
  3. Compile and JAR or DLL the CustomScreenValidator.
  1. Run a Web Determinations Interview

Source

To view the source code for the CustomScreenValidator sample, refer to examples\interview-engine\custom-screen-validator in the Java or .NET runtime zip file.